﻿using Grpc.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace UserCenter.Api.CallContexts
{
    public abstract class BaseCallServerContext : ServerCallContext
    {

        ServerCallContext defaultServerCallContext;

        public BaseCallServerContext(ServerCallContext serverCallContext)
        {
            defaultServerCallContext = serverCallContext;
        }

        protected override string MethodCore => defaultServerCallContext.Method;

        protected override string HostCore => defaultServerCallContext.Host;

        protected override string PeerCore => defaultServerCallContext.Peer;

        protected override DateTime DeadlineCore => defaultServerCallContext.Deadline;

        protected override Metadata RequestHeadersCore => defaultServerCallContext.RequestHeaders;

        protected override CancellationToken CancellationTokenCore => defaultServerCallContext.CancellationToken;

        protected override Metadata ResponseTrailersCore => defaultServerCallContext.ResponseTrailers;


        protected override AuthContext AuthContextCore => defaultServerCallContext.AuthContext;

        protected override Status StatusCore
        {
            get => defaultServerCallContext.Status;
            set
            {
                defaultServerCallContext.Status = value;

            }
        }
        protected override WriteOptions WriteOptionsCore
        {
            get => defaultServerCallContext.WriteOptions;
            set
            {
                defaultServerCallContext.WriteOptions = value;
            }
        }

        protected override ContextPropagationToken CreatePropagationTokenCore(ContextPropagationOptions options)
        {
            return defaultServerCallContext.CreatePropagationToken(options);
        }

        protected override Task WriteResponseHeadersAsyncCore(Metadata responseHeaders)
        {
            return defaultServerCallContext.WriteResponseHeadersAsync(responseHeaders);
        }
    }
}
